package dyyx;

import java.util.concurrent.TimeUnit;

import com.google.common.base.Stopwatch;

public class StopWatchTest {
	
	
	public static void main(String[] args) throws Exception {		
		
		 Stopwatch watch = Stopwatch.createStarted();
		 Thread.sleep(1000L);
		 long time = watch.elapsed(TimeUnit.MILLISECONDS);
		 System.out.println(time);
		 time = watch.elapsed(TimeUnit.NANOSECONDS);
		 System.out.println(time);
		 
		 Stopwatch watch1 = Stopwatch.createUnstarted();
		 watch1.start();
		 Thread.sleep(1000L);
		 watch1.stop();
		 watch1.start();
		 Thread.sleep(500L);
		 time = watch1.elapsed(TimeUnit.MILLISECONDS);
		 System.out.println(time);
		 
		
	}
}
